﻿@implements IDisposable

<MudGrid>
    <MudItem md="4">
        <MudButton OnClick="OpenFullscreenMode" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Fullscreen" Color="Color.Error">Fullscreen Mode</MudButton>
    </MudItem>
    <MudItem md="12" id="fullscreen">
        <MudText Typo="Typo.h1">h1. Heading</MudText>
        <MudText Typo="Typo.h2">h2. Heading</MudText>
        <MudText Typo="Typo.h3">h3. Heading</MudText>
        <MudText Typo="Typo.h4">h4. Heading</MudText>
        <MudText Typo="Typo.h5">h5. Heading</MudText>
        <MudText Typo="Typo.h6">h6. Heading</MudText>
        <MudText Typo="Typo.subtitle1">subtitle1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur</MudText>
        <MudText Typo="Typo.subtitle2">subtitle2. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur</MudText>
        <MudText Typo="Typo.body1">body1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur, neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum quasi quidem quibusdam.</MudText>
        <MudText Typo="Typo.body2">body2. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur, neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum quasi quidem quibusdam.</MudText>
        <MudButton OnClick="CloseFullscreenMode" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.FullscreenExit" Color="Color.Error">Close Fullscreen Mode</MudButton>
    </MudItem>
</MudGrid>

@code {

    private async Task OpenFullscreenMode()
    {
        try
        {
            await Fullscreen.OpenFullscreenAsync("fullscreen");
        }
        catch (Exception ex)
        {
            Snackbar.Add($"{DashboardResource.StringError} : {ex.ToString()}", Severity.Error);
        }
    }

    private async Task CloseFullscreenMode()
    {
        try
        {
            await Fullscreen.CloseFullscreenAsync();
        }
        catch (Exception ex)
        {
            Snackbar.Add($"{DashboardResource.StringError} : {ex.ToString()}", Severity.Error);
        }
    }

    public async void Dispose() => await Dom.DisposeAsync();
}